import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [

   {
    title: '摄像头id',
    align:"center",
    dataIndex: 'cameraId'
   },
   {
    title: '人员id',
    align:"center",
    dataIndex: 'personId'
   },
   {
    title: '照片',
    align:"center",
    dataIndex: 'photo'
   },
  {
    title: '创建日期',
    align:"center",
    sorter: true,
    dataIndex: 'createTime'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "拍照日期",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:false
      },
	},
  {
    label: "人员",
    field: "personId",
    component: 'JSearchSelect',
    componentProps: {
      dict:"ss_person where status !=0 ,name,id",
      pageSize: 5,
      async: true,
    },
    colProps:{span:8}
  }
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '创建日期',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '摄像头id',
    field: 'cameraId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入摄像头id!'},
          ];
     },
  },
  {
    label: '人员id',
    field: 'personId',
    component: 'Input',
  },
  {
    label: '照片',
    field: 'photo',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入照片!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  createTime: {title: '创建日期',order: 0,view: 'datetime', type: 'string',},
  cameraId: {title: '摄像头id',order: 1,view: 'text', type: 'string',},
  personId: {title: '人员id',order: 2,view: 'text', type: 'string',},
  photo: {title: '照片',order: 3,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
